var lBtn=document.querySelector(".fl"),rBtn=document.querySelector(".fr"),
    aName=document.querySelectorAll(".gameTab li"),aNc=document.querySelectorAll(".gameTab li span"),
    oPic=document.querySelector(".gamePic"),aPic=oPic.querySelectorAll("li"),
    gameName=["塞尔达传说：旷野之息","splatoon2","星之卡比：新星同盟","马力欧网球","任天堂明星大乱斗"],
    index2=0;

console.log(aPic);

for(var i=0;i<5;i++){

    aName[i].index=i;
    aName[i].onmouseover=function () {
        leave();
        index2=this.index;
        enter();
    }
}
function leave(){
    aName[index2].className="shorter";
    aNc[index2].innerHTML="";
    aPic[index2].className=""
}
function enter(){
    aName[index2].className="on";
    aNc[index2].innerHTML=gameName[index2];
    aPic[index2].className="active";
}

rBtn.onclick=function(){
    leave();
    index2+=1;
    index2%=5;
    enter();
}
lBtn.onclick=function(){
    leave();
    index2===0?index2=4:index2-=1;
    enter();
}
/*    function xmove() {
        var dt=a-b,j=0;
        setInterval(,100);
        function zizeng(i){i=+10;console.log(i)}


        oPic.style.left=dx+"%";
    }*/
/*    function xmove(a,b) {
        var dt=a-b,h=oPic.style.left.replace("%","");
        var dxmove=setInterval(function(){
            h++;
            if(h === 100*dt)clearInterval(dxmove);
            oPic.style.left=-h+"%";
        },5/dt);
    }*/

